package com.gxuwz.medical.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.gxuwz.medical.domain.family.Family;

/**
 * 家庭档案管理数据访问层
 * @ClassName: FamilyDao
 * @author SunYi
 * @Date 2019年4月28日上午11:37:24
 */
public class FamilyDao extends GenericDao<Family> {
	
	/**
	 * 实现ResultSet结果集转换为Family类型实例
	 * @author SunYi
	 * @Date 2019年4月28日上午11:37:24
	 */
	@Override
	protected Family handle(ResultSet rs) throws SQLException {
		try{
			// 实例化行政区域对象
			Family model = new Family();
			// 取出ResultSet的值,存进Family对象
			model.setCountyCode(rs.getString("countyCode"));
			model.setTownCode(rs.getString("townCode"));
			model.setVillageCode(rs.getString("villageCode"));
			model.setGroupCode(rs.getString("groupCode"));
			model.setFamilyCode(rs.getString("familyCode"));
			model.setHouseHolder(rs.getString("houseHolder"));
			model.setFamilySize(rs.getInt("familySize"));
			model.setAgriculturalNum(rs.getInt("agriculturalNum"));
			model.setAddress(rs.getString("address"));
			model.setCreateTime(rs.getDate("createTime"));
			model.setRegistrar(rs.getString("registrar"));
			model.setHouseholdType(rs.getString("householdType"));
			// 返回家庭档案对象
			return model;
		}catch(SQLException e){
			throw new SQLException("结果集转为实例失败!",e);
		}
	}

}
